﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using wjy自制小框架.Common.Pojo;
using wjy自制小框架.Web.Demo;

namespace wjy自制小框架.Web
{
    /// <summary>
    /// 控制器总入口
    /// wjy
    /// </summary>
    class CommonController
    {
        /// <summary>
        /// 控制器总入口
        /// </summary>
        /// <param name="path">路径，如：/demo/demo/list</param>
        /// <param name="param">参数</param>
        public AjaxResult Start(string path, JObject param)
        {
            var urls = path.Split('/');
            switch ($"/{ urls[1] }/{ urls[2] }")
            {
                #region demo模块

                // 测试demo
                case "/demo/demo": return new DemoController().Start(urls[3], param);
                #endregion
            }
            return AjaxResult.error("接口不存在");
        }
    }
}
